package com.twu.biblioteca;

import static java.lang.System.out;

public class BibliotecaLibrary {

    Register register = new Register();

    public void displayBook()
    {
        System.out.println("The Books are");
        for (Object list : register.getBooklist())
        {
            displayallBooks((Book) list);
        }
    }

    private void displayallBooks(Book list) {
        System.out.println(list.getBookname() );
    }

    public void displayMovies()
    {
        System.out.println("The Movies are");
        for (Movies list : register.getMovielist())
        {
            displayallMovies(list);
        }
    }

    private void displayallMovies(Movies list) {
        System.out.println("Movie Name:" + list.getName() + " Director:" + list.getDirector() + " Year:" +  list.getYear() + " Movie Rating:" +  list.getMovierating());
    }

    public void checkOutBooks(String book, String customername)
    {
        if(register.checkOutBook(book, customername))
            System.out.println("Thank you! Enjoy your book");
        else
            System.out.println("That book is not available .... please make sure that book exist");
    }

    public void checkOutMovies(String movie)
    {
        if(register.checkOutMovie(movie))
            System.out.println("Thank you! Enjoy your Movie");
        else
            System.out.println("This Movie is not available .... please make sure that movie exist");
    }

    public void BookReturn(String bookname)
    {
        if(register.returnBook(bookname))
            System.out.println("Thank you for returning the book");
        else
            System.out.println("That is not a valid book to return ... please make sure that you are returning the correct book");
    }

    public void showUserDetails(String customername) {
        register.displayDetailsOfCustomer(customername);
    }
}



